﻿@model BBICMS.Model.View.SocialVM
@{
    
    ViewBag.Title = "社交资料";
    ViewBag.PageTitle = ViewBag.Title + "_常规设置";
    
    Html.EnableUnobtrusiveJavaScript(true);

    var options = new AjaxOptions()
    {
        Url = Url.Action("Social", "Info"),
        LoadingElementId = "saving",
        LoadingElementDuration = 2000,
     //   Confirm = "Are you sure you want to save this User?"
         OnSuccess = "updateSuccess"
        
    };  

}
@section header{
    <script src="~/plugins/ckfinder/ckfinder.js"></script>
    
}




<div class="toolbar">
    <a href="#" class="showmenu"><i class="fa fa-bars"></i></a>
    <ol class="breadcrumb">
        <li><a href="@Url.Action("Index","Home")"><i class="glyphicon glyphicon-home"></i> 控制面板</a></li>
        <li><a href="#">基础设置</a></li>
        <li class="active">@ViewBag.Title</li>
    </ol>
</div>
<div class="main-content">
    



    <div class="box">
        <header class="box-header">
            <h3><i class="glyphicon glyphicon-comment"></i> @ViewBag.Title</h3>
            <div class="control">
                <a href="#" class="expand"><i class="fa fa-expand"></i></a>
                <a href="#" class="compress"><i class="fa fa-compress"></i></a>
            </div>
        </header>
        <section class="box-body">
            

                @using (Ajax.BeginForm("Social", null, options, new { @class = "form-horizontal", role = "form" }))
                {

                @Html.AntiForgeryToken()
                @Html.ValidationSummary(false)


                <div class="form-group">
                    @Html.LabelFor(model => model.Oicq, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.Oicq, new { @class = "form-control", placeholder = "腾讯QQ" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Oicq)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.SinaWeibo, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.SinaWeibo, new { @class = "form-control", placeholder = "新浪微博" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.SinaWeibo)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.WeiXing, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.WeiXing, new { @class = "form-control", placeholder = "微信帐号" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.WeiXing)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.WeiXingCode, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        <div class="input-group">
                            @Html.TextBoxFor(model => model.WeiXingCode, new { @class = "form-control", placeholder = "微信二维码" })
                            <span class="input-group-btn">
                                <button class="btn btn-default" id="btnWeiXingCode" type="button">浏览…</button>
                            </span>
                        </div><!-- /input-group -->
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.WeiXingCode)
                    </div>
                </div>




    <div class="form-group">
        <div class="col-sm-offset-2 col-md-10">
            <input type="submit" class="btn btn-primary" value="保存资料" />
        </div>
        @*<div class="col-md-7">
                @TempData["message"]
            </div>*@
    </div>
                }

        </section>
        <footer class="box-footer">
           

        </footer>

    </div>

</div>


@section footer {


    @Scripts.Render("~/bundles/jqueryval")

<script>
    function updateSuccess(data) {
       
        //  console.log(data.Oicq);
        toastr.options = {
            "closeButton": false,
            "debug": false,
            "positionClass": "toast-bottom-full-width",
            "onclick": null,
            "showDuration": "300",
            "hideDuration": "1000",
            "timeOut": "5000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        }
        toastr.success('社交资料已保存成功', '保存')
      //  debugger;
    }

   // CKFinder.setupCKEditor(editor, '@Url.Content("~/plugins/ckfinder/")');


    function SetThumbnail(fileUrl) {
        $('#WeiXingCode').val(fileUrl);
    }


    $(function () {

        $("#btnWeiXingCode").on("click", function () {
            var finder = new CKFinder();
            //  finder.basePath = '/plugins/ckfinder/';
            finder.selectActionFunction = SetThumbnail;
            finder.popup();
        });

        $(".mainmenu>li").eq(6).addClass('nav-open').find('.submenu li').eq(2).children('a').addClass('active');
    });
</script>
  
}
